package main

import (
	"mongodb_connection_monitor/pkg/cmdb_info"
	"mongodb_connection_monitor/pkg/load_config"
	"mongodb_connection_monitor/pkg/mongo_utils"
	"mongodb_connection_monitor/pkg/self_log_module"
)

func main() {

	var file = self_log_module.GetLog("exec.log")
	defer file.Close()

	var (
		cmdbUrl string
	)
	// Escape special characters in the password
	config, err := load_config.GetConfig("config.toml", "./config")
	if err != nil {
		panic(err)
	}
	cmdbUrl = config.All.CmdbMongoDBUrl
	netTypeList := config.All.NetTypeList
	mongodbInfoList, err := cmdb_info.GetMongoDBCmdbInfo(cmdbUrl,netTypeList)
	if err == nil {
		for _, mongodbInfo := range mongodbInfoList {
			mongo_utils.MongoDBCurrentOper(mongodbInfo)
		}
	}
}
